package com.dreamthen.aspects;

import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @Author zengms
 * @Date 2023-10-26 18:58:05
 **/

@Aspect
@Component
public class LogUtil {

    // execution(访问修饰符  返回值类型 方法全称)
    @Before("execution(* com.dreamthen.service.impl.UserServiceImpl.*(..))")
    public static void before() {
        System.out.println("前置通知");
    }

    @After("execution(* com.dreamthen.service.impl.UserServiceImpl.*(..))")
    public static void after() {
        System.out.println("后置通知");
    }

    @AfterThrowing("execution(* com.dreamthen.service.impl.UserServiceImpl.*(..))")
    public static void afterException() {
        System.out.println("后置异常通知");
    }

    @AfterReturning("execution(* com.dreamthen.service.impl.UserServiceImpl.*(..))")
    public static void afterReturn() {
        System.out.println("后置返回通知");
    }
}
